package com.ibeetl.admin.aod.web.query;

import com.ibeetl.admin.core.annotation.Query;
import com.ibeetl.admin.core.util.Tool;
import com.ibeetl.admin.core.util.enums.CoreDictType;
import com.ibeetl.admin.core.web.query.PageParam;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * 行业数据导出查询
 */
@Data
public class AodIndustryDataExportQuery extends PageParam {

    @Query(name = "行业类别", display = true, type = Query.TYPE_INDUSTRY)
    private Long industryId;

    @Query(name = "账号", display = true)        
    private String account;

    @Query(name = "手机号码", display = true)        
    private String phoneNumber;

    @Query(name = "创建时间", display = true, type = Query.TYPE_DATE_BETWEEN)
    private String addTimeRange;

    private Date addTimeMin;

    private Date addTimeMax;

    public void setAddTimeRange(String addTimeRange) {
        this.addTimeRange = addTimeRange;
        if(StringUtils.isEmpty(addTimeRange)) {
            return ;
        }
        Date[] ds = Tool.parseDateTimeRange(addTimeRange);
        this.addTimeMin = ds[0];
        this.addTimeMax = ds[1];
    }

    @Query(name = "省份", display = true, type = Query.TYPE_DICT,dict = CoreDictType.PROVINCE_DATA, group = "province_data")
    private String province;

    @Query(name = "城市", display = true, type = Query.TYPE_DICT,dict = CoreDictType.CITY_DATA, group = "city_data")
    private String city;

    @Query(name = "供应商", display = true, type = Query.TYPE_DICT,dict = CoreDictType.CORP)
    private String corp;

    @Query(name = "等级", display = true, type = Query.TYPE_DICT,dict = CoreDictType.DATA_LEVEL)
    private String level;

    private String tableName;

}
